<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.util.List" %>
<%@ page import="com.hotel.entity.SubscriptionInfo" %>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/hotel/style/style.css" />
    <title>订单列表</title>
    <style type="text/css">
        table {
            margin: auto;
            margin-top: 20px;
            width: 700px;
            border-collapse: collapse;
        }
        th, td {
            border: solid 1px #000000;
            padding: 6px 1px;
        }
        .index {
            width: 50px;
            text-align: center;
        }
        .no, .shortname, .phone, .email, .status, .opt {
            text-align: center;
        }
        .message {
            text-align: center;
            margin-top: 30px;
            font-size: 16px;
            color: gray;
        }
    </style>
</head>
<body>
<div id="container">
    <div id="header">
        <ul>
            <li>
                <a href="<%=request.getContextPath()%>/hotel/manager/login.jsp"
                   onclick="return confirm('确定要退出登录吗？');">退出</a>
            </li>

        </ul>
    </div>
    <div id="menu">
        <ul>
            <li><a href="<%=request.getContextPath()%>/hotel/manager/bookQuery.jsp">客房管理</a></li>
            <li><a href="<%=request.getContextPath()%>/hotel/manager/memberQuery.jsp">会员管理</a></li>
            <li><a href="<%=request.getContextPath()%>/hotel/manager/subscriptionQuery.jsp">订单管理</a></li>
        </ul>
    </div>
    <div id="content">

        <%
            List<SubscriptionInfo> subscriptions = (List<SubscriptionInfo>) request.getAttribute("subscriptions");
            if (subscriptions != null && !subscriptions.isEmpty()) {
        %>

        <table>
            <tr>
                <th>序号</th>
                <th>订单号</th>
                <th>联系人</th>
                <th>电子邮件</th>
                <th>联系电话</th>
                <th>状态</th>
                <th>操作</th>
            </tr>
            <%
                int index = 1;
                for (SubscriptionInfo s : subscriptions) {
            %>
            <tr>
                <td><%= index++ %></td>
                <td><a href="<%= request.getContextPath() %>/viewOrderDetails.member?no=<%= s.getNo() %>"><%= s.getNo() %></a></td>
                <td><%= s.getLinkman() %></td>
                <td><%= s.getPhone() %></td>
                <td><%= s.getEmail() %></td>
                <td>
                    <%
                        int status = s.getStatus();
                        String statusText = (status == 0) ? "已取消" : (status == 1 ? "待确认" : "已确认");
                    %>
                    <%= statusText %>
                </td>
                <td>
                    <a href="#" onclick="return confirm('真的要删除该订单及其明细信息吗？') ? location.href='<%=request.getContextPath()%>/deleteSubscription2.member?no=<%= s.getNo() %>' : false;">删除</a>
                </td>
            </tr>
            <% } %>
        </table>

        <%
        } else {
        %>
        <div class="message">没有符合条件的订单记录。</div>
        <%
            }
        %>

        <div style="text-align: center; margin-top: 20px;">
            <input type="button" value="返回" onclick="location='<%=request.getContextPath()%>/hotel/manager/subscriptionQuery.jsp'" />
        </div>
    </div>
</div>
</body>
</html>
